<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/23 0023
 * Time: 12:35
 */
namespace app\admin\controller;
class Website extends Common
{
   private  $db;
   public function __init(){
       $this->db= new \system\model\Website();
   }

    /**
     * 显示所有数据
     * @return mixed
     */
  public  function index(){
       if(IS_POST){
          foreach ($_POST['value'] as $k=>$v){
              if(!$v){
                  message($k.'不能为空','back','error');
              }
               $this->db->where('name',$k)->update(['value'=>$v]);
          }
           message('修改成功',u('index'),'success');
       }
       $oldData=Db::table('website')->get();
       View::with('oldData',$oldData);
       return view();
  }


}